package com.khyr.fegin;

import com.khyr.entity.User;
import com.khyr.vo.R;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @className: UserFactory
 * @author: Zyl
 * @date: 2025/3/12 17:05
 * @Version: 1.0
 * @description:
 */
@Component
public class UserFactory implements FallbackFactory<UserFegin> {
    @Override
    public UserFegin create(Throwable cause) {
        //匿名实现类
        return new UserFegin() {
            @Override
            public R<User> getUserInfo(HttpServletRequest request) {
                return new R<>(500,"服务器故障",null);
            }
        };

    }
}
